package druid.servlet;

import druid.dao.TipDao;
import druid.entity.Tip;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;

@WebServlet(name = "ServletInserTestDruid",value = "/DruidAdd")
public class ServletInserTestDruid extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Tip tip =new Tip(3,"大名朋友",20,2,new Date(),"goodstudy,daydayup");
        TipDao tipDao =new TipDao();
        tipDao.add(tip);

        List<Tip> list = tipDao.select("同学");
        PrintWriter out = resp.getWriter();
        for (Tip t : list){
            out.print(t);
            out.print("</br>");
        }
    }


}
